<script>
import { useThemeStore } from '@/stores/theme'

import { useUserStore } from '@/stores/user'

import { computed } from 'vue'

export default {
  setup() {
    const themeStore = useThemeStore()

    const userStore = useUserStore()

    return {
      themeStore,
      userStore,
    }
  },
  provide() {
    return {
      globalClass: computed(() => {
        return {
          'light': this.themeStore.theme === 'light',
          'dark': this.themeStore.theme === 'dark',
        }
      }),
      theme: computed(() => this.themeStore.theme),
    }
  },
  onLaunch: function () {
    this.themeStore.init()
    this.userStore.init()
  },
}
</script>

<style lang="scss">
@import url('static/fonts/ukijtor.css');

page {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  color: #101318;
  font-family: 'UKIJ Tor';
  font-size: 22.9rpx;
  line-height: 1.35;
  text-align: justify;
  direction: rtl;
  overflow: hidden;
}

view,
scroll-view {
  box-sizing: border-box;
}

image {
  flex-shrink: 0;
  display: block;
  width: 100%;
  height: 100%;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
  color: transparent;
  display: none;
}

.index {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: #FFFFFF;
  overflow: hidden;
}

.scroll-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  overflow-anchor: none;
}

.page-bottom-safe-area {
  flex-shrink: 0;
  width: 100%;
  height: 61.069rpx;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rtl {
  direction: rtl;
}

.ltr {
  direction: ltr;
}

.relative {
  position: relative;

  .absolute-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    color: transparent;
    outline: none;
    border: none;

    &::after,
    &::before {
      display: none;
    }
  }
}

.toggle-opacity {
  opacity: 0;
  transition: all .2s ease;
  visibility: hidden;

  &.show {
    visibility: visible;
    opacity: 1;
  }
}

.dark.index {
  background-color: #000000;
}
</style>
